<?php

/**
 * rmPlannedOut filter form base class.
 *
 * @package    ressourceManager
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BasermPlannedOutFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id_out_type'    => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('idOutType'), 'add_empty' => true)),
      'id_user'        => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('idUser'), 'add_empty' => true)),
      'out_day'        => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'out_slot'       => new sfWidgetFormChoice(array('choices' => array('' => '', 'am' => 'am', 'pm' => 'pm', 'all' => 'all'))),
    ));

    $this->setValidators(array(
      'id_out_type'    => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('idOutType'), 'column' => 'id_out_type')),
      'id_user'        => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('idUser'), 'column' => 'id_user')),
      'out_day'        => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDateTime(array('required' => false)))),
      'out_slot'       => new sfValidatorChoice(array('required' => false, 'choices' => array('am' => 'am', 'pm' => 'pm', 'all' => 'all'))),
    ));

    $this->widgetSchema->setNameFormat('rm_planned_out_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'rmPlannedOut';
  }

  public function getFields()
  {
    return array(
      'id_planned_out' => 'Number',
      'id_out_type'    => 'ForeignKey',
      'id_user'        => 'ForeignKey',
      'out_day'        => 'Date',
      'out_slot'       => 'Enum',
    );
  }
}
